package org.newlucene.core.search;

import java.util.HashMap;

public class SubCollector implements HitCollector
{
    private HashMap<Integer, Bucket> bucketTable;
    private int mask;

    public SubCollector()
    {    	
    }
      
//    public SubCollector(HashMap<Integer, Bucket> bucketTable, int mask)
//    {
//        this.bucketTable = bucketTable;
//        this.mask = mask;
//    }

    public void set(HashMap<Integer, Bucket> bucketTable, int mask)
    {
        this.bucketTable = bucketTable;
        this.mask = mask;    	
    }

    public void collect(int doc, float score)
    {
    	// see if this doc is already in bucketTable
    	if (bucketTable.containsKey(doc))
    	{
    		Bucket b = bucketTable.get(doc);
    		b.score += score;	// increment the score
    		b.bits |= mask;	// add bits in mask
    	}
    	else
    	{
        	Bucket b = new Bucket();
        	b.score = score;	// initialize score
        	b.bits = mask;	// initialize mask
        	bucketTable.put(doc, b);
    	}
    }

    public int getTotalHits()
    {
        throw new UnsupportedOperationException();
    }

    public ScoreDoc[] getScoreDocs()
    {
        throw new UnsupportedOperationException();
    }

    public int getNumScoreDocs()
    {
        throw new UnsupportedOperationException();
    }

    public int getCapacity()
    {
        throw new UnsupportedOperationException();
    }
}